\documentclass{article}

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

This thing costs \SI{123456}{\$}.
There are \num{987654} people in this room, \SI{38}{\percent} of which are male.

\vspace{1cm}

\sisetup{
    round-mode = places,
    round-precision = 3
}%
You can also round numbers, for example \num{1.23456}.

\vspace{1cm}

\texttt{siunitx} can also be used to better align numbers in tables using the \texttt{S}
column type.

\begin{table}[h]
    \centering
    \begin{tabular}{lS}
        \toprule
        Name & {Value} \\ % headers of S columns have to be in {}
        \midrule
        Test & 2.3456 \\
        Blah & 34.2345 \\
        Foo & -6.7835 \\
        Bar & 5642.5 \\
        \bottomrule
    \end{tabular}
    \caption{Numbers alignment with \texttt{siunitx}.}
\end{table}

\end{document}
